package com.quectel.core.module.application.dto;

import com.quectel.core.module.device.dto.DeviceCategoryDto;
import com.quectel.core.module.device.dto.DeviceTypeDto;
import com.quectel.core.module.village.dto.VillageDto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 应用表
 *
 * @author rananxin
 * @email: ryan.ran@quectel.com
 * @date 2021-11-02 10:59:33
 */
@Data
@Schema
public class ApplicationDto implements Serializable {

    /**
     * id
     */
    @Schema(description = "id")
    private Long id;

    /**
     * 租户id
     */
    @Schema(description = "租户id")
    private Long tenantId;

    /**
     * 小区id
     */
    @Schema(description = "小区id")
    private Long villageId;

    /**
     * 类型id
     */
    @Schema(description = "类型id")
    @NotNull
    private Long deviceTypeId;

    /**
     * 种类id
     */
    @Schema(description = "种类id")
    @NotNull
    private Long deviceCategoryId;

    /**
     * 接入方式id
     */
    @Schema(description = "接入方式id")
    @NotNull
    private Long accessConfId;

    /**
     * 模版id
     */
    @Schema(description = "模版id")
    @NotNull
    private Long accessTemplateId;

    /**
     * 产品名称
     */
    @Schema(description = "产品名称")
    @NotBlank
    @Length(min = 1, max = 80)
    private String name;

    /**
     * 协议类型 0其他 1HTTP 2MQTT 3TCP
     */
    @Schema(description = "协议类型 0其他 1HTTP 2MQTT 3TCP")
    @NotNull
    @Range(min = 0, max = 3)
    private Byte protocolType;

    /**
     * 接入配置
     */
    @Schema(description = "接入配置")
    @NotBlank
    private String accessConf;

    /**
     * 状态 0禁用 1启用
     */
    @Schema(description = "状态")
    @NotNull
    @Range(min = 0, max = 1)
    private Byte status;

    /**
     * 初始化配置 0失败 1成功
     */
    @Schema(description = "初始化配置 0失败 1成功")
    private Byte initStatus;

    /**
     * 定时任务最近一次执行时间
     */
    @Schema(description = "初定时任务最近一次执行时间")
    private Date lastExecTaskTime;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    /**
     *
     */
    @Schema(description = "")
    private String creator;

    /**
     *
     */
    @Schema(description = "")
    private Date createTime;

    /**
     *
     */
    @Schema(description = "")
    private String editor;

    /**
     *
     */
    @Schema(description = "")
    private Date editTime;

    /************非数据库字段 start ************/
    @Schema(description = "设备种类信息")
    private DeviceCategoryDto deviceCategory;

    @Schema(description = "设备类型信息")
    private DeviceTypeDto deviceType;

    @Schema(description = "小区信息")
    private VillageDto village;

    @Schema(description = "配置模版")
    private ApplicationAccessTemplateDto applicationAccessTemplate;

    @Schema
    private ApplicationAccessConfDto applicationAccessConf;

    /************非数据库字段 end **************/
}
